import 'package:flutter/material.dart';

class GridViewExtentWidget extends StatelessWidget {
  const GridViewExtentWidget({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        backgroundColor: Colors.amber,
        title: const Text('案例-GridViewExtent'),
      ),
      body: GridView.extent(
        maxCrossAxisExtent: 80,
        mainAxisSpacing: 10,
        crossAxisSpacing: 5,
        children: List.generate(20, (index) {
          return Container(
            color: Colors.purpleAccent,
            alignment: Alignment.center,
            child: Text("我学习我无敌$index"),
          );
        }),
      ),
    );
  }
}
